import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import("../views/Home.vue"),
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/About.vue')
  },
  {
    path: '/article',
    name: 'article',
    component: () => import('../views/Article/Article.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/info',
    name: 'info',
    component: () => import('../views/Info.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/learn',
    name: 'learn',
    component: () => import('../views/Learn/Learn.vue')
  },
  {
    path: '/article/search',
    name: 'search',
    component: () => import('../views/Article/Search.vue')
  },
  {
    path: '/article/knowledge',
    name: 'knowledge',
    component: () => import('../views/Article/Knowledge.vue')
  },
  {
    path: '/article/case',
    name: 'case',
    component: () => import('../views/Article/Case.vue')
  },
  {
    path: '/article/share',
    name: 'share',
    component: () => import('../views/Article/Share.vue')
  },
  {
    path: '/article/knowledge/kdetails',
    name: 'kdetails',
    component: () => import('../views/Article/Kdetails.vue')
  },
  {
    path: '/article/case/cdetails',
    name: 'cdetails',
    component: () => import('../views/Article/Cdetails.vue')
  },
  {
    path: '/article/share/sdetails',
    name: 'sdetails',
    component: () => import('../views/Article/Sdetails.vue')
  },
  {
    path: '/learn/question',
    name: 'question',
    component: () => import('../views/Learn/Question.vue')
  },
  {
    path: '/learn/scenechoose',
    name: 'scenechoose',
    component: () => import('../views/Learn/Scenechoose.vue')
  },
  {
    path: '/learn/scene1-1',
    name: 'scene1-1',
    component: () => import('../views/Learn/Scene1-1.vue')
  },
  {
    path: '/learn/scene1-2',
    name: 'scene1-2',
    component: () => import('../views/Learn/Scene1-2.vue')
  },
  {
    path: '/learn/scene1-3',
    name: 'scene1-3',
    component: () => import('../views/Learn/Scene1-3.vue')
  },
  {
    path: '/learn/scene1-4',
    name: 'scene1-4',
    component: () => import('../views/Learn/Scene1-4.vue')
  },
  {
    path: '/learn/scene1-5',
    name: 'scene1-5',
    component: () => import('../views/Learn/Scene1-5.vue')
  },
  {
    path: '/learn/scene1-6',
    name: 'scene1-6',
    component: () => import('../views/Learn/Scene1-6.vue')
  },
  {
    path: '/learn/scene1-7',
    name: 'scene1-7',
    component: () => import('../views/Learn/Scene1-7.vue')
  },
  {
    path: '/learn/scene1-8',
    name: 'scene1-8',
    component: () => import('../views/Learn/Scene1-8.vue')
  },
  {
    path: '/learn/scene1-9',
    name: 'scene1-9',
    component: () => import('../views/Learn/Scene1-9.vue')
  },
  {
    path: '/myshare',
    name: 'myshare',
    component: () => import('../views/Myshare.vue')
  },
  {
    path: '/admin/manage',
    name: 'manage',
    component: () => import('../views/Manage.vue')
  },
  {
    path: '*',
    redirect: '/'
  }
]

const router = new VueRouter({
  routes
})

export default router
